<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/2/17 0017
 * Time: 0:41
 */

namespace app\validate;


use think\Validate;

class UserBaseValidate extends ValidateBase
{
    protected $rule = [
        'id'=>'require|number',
        'account'=>'require|alphaDash',
        'account_status'=>'require|in:1,0',
        'password'=>'require',
        'mobilephone'=>'require|checkPhone',
        'sex'=>'require|in:1,2',
        'reg_ip'=>'require|ip',
        'reg_time'=>'require|number',
        'birthday'=>'require|number',
        'nickname'=>'require|chsDash',
        'qq_number'=>'require|number',
        'e_mail'=>'require|checkEMail',
        'role_id'=>'require|number'
    ];
    protected $message = [
        'id.require'=>'未获取修改信息',
        'id.number'=>'修改信息错误',
        'account.require'=>'未获取到账号',
        'account.alphaDash'=>'账号格式错误',
        'account_status.require'=>'账号状态错误',
        'account_status.in:1,0'=>'账号状态错误',
        'password.require'=>'请设置密码',
        'mobilephone.require'=>'请填写手机号码',
        'mobilephone.checkPhone'=>'手机号码错误',
        'sex.require'=>'请设置性别',
        'sex.in:1,2'=>'性别设置错误',
        'reg_ip.require'=>'未获取到注册ip',
        'reg_ip.ip'=>'注册ip格式错误',
        'reg_time.require'=>'未获取到注册时间',
        'reg_time.number'=>'注册时间错误',
        'birthday.require'=>'请填写出生日期',
        'birthday.number'=>'出生日期时间有误',
        'nickname.require'=>'请填写昵称',
        'nickname.chsDash'=>'昵称不符合',
        'qq_number.require'=>'请填写QQ号码',
        'qq_number.number'=>'QQ号码格式有误',
        'e_mail.require'=>'请填写邮箱',
        'e_mail.checkEMail'=>'邮箱格式有误',
        'role_id.require'=>'请设置角色',
        'role_id.number'=>'角色错误',
    ];

    protected $scene =[
        'checkWebAccount'=>[
            'mobilephone',
            'sex',
            'reg_ip',
            'birthday',
            'nickname',
        ],
        'checkAdminAddData'=>[
            'account',
            'mobilephone',
            'sex',
            'birthday',
            'nickname',
            'role_Id'
        ],
        'checkAdminAddDataDb'=>[
            'account',
            'mobilephone',
            'sex',
            'birthday',
            'nickname',
            'account_status',
            'password',
            'reg_time',
        ],
        'checkAdminUpdateData'=>[
            'id',
            'account',
            'mobilephone',
            'sex',
            'birthday',
            'nickname',
            'role_Id'
        ],
        'checkAdminUpdateDataDb'=>[
            'id',
            'account',
            'mobilephone',
            'sex',
            'birthday',
            'nickname',
            'account_status',
        ],
        'checkPhone'=>[
            'mobilephone',
        ],
        'checkUpdatePasswordData'=>[
            'id',
            'password',
        ],
        'checkUpdateAccount'=>[
            'id',
            'account_status',
        ],
    ];

}